package com.aiti.lulian.service.impl;



import com.aiti.base.core.page.PageInfo;
import com.aiti.base.core.page.PageResult;
import com.aiti.base.core.utils.message.Message;
import com.aiti.lulian.dto.CardPromotionWithdrawRecordDto;
import com.aiti.lulian.entity.crad.promotion.CardPromotionSub;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.aiti.lulian.entity.CardPromotionWithdrawRecord;
import com.aiti.lulian.mapper.promotion.CardPromotionWithdrawRecordMapper;
import com.aiti.lulian.service.ICardPromotionWithdrawRecordService;
import org.springframework.stereotype.Service;

@Service
public class CardPromotionWithdrawRecordServiceImpl extends ServiceImpl<CardPromotionWithdrawRecordMapper, CardPromotionWithdrawRecord> implements ICardPromotionWithdrawRecordService {
    @Override
    public Message withdrawRecordList(Page page, CardPromotionWithdrawRecordDto dto) {
        LambdaQueryWrapper<CardPromotionWithdrawRecord> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CardPromotionWithdrawRecord::getPkId,dto.getPkId()).orderByDesc(CardPromotionWithdrawRecord::getBaseCreateTime);
        Page page1 = this.page(page, wrapper);
        PageResult rspData = new PageResult(page1.getRecords(), new PageInfo(dto.getPageNum(), dto.getPageSize()), page1.getTotal());
        return Message.success(rspData);
    }
}